package core

import (
	"github.com/go-mysql-org/go-mysql/canal"
	"github.com/go-mysql-org/go-mysql/replication"
	"log"
)

type EventHandler struct {
	canal.DummyEventHandler
}

// OnRow 数据变化
func (h *EventHandler) OnRow(e *canal.RowsEvent) error {
	log.Printf("Action: %s,Schema:%s, Table: %s, Rows: %v\n", e.Table.Schema, e.Action, e.Table.Name, e.Rows)
	return nil
}

// OnTableChanged 表结构变化
func (h *EventHandler) OnTableChanged(header *replication.EventHeader, schema string, table string) error {
	log.Printf("Table Changed: %s.%s\n", schema, table)
	return nil
}
